#include "matrix_thread.h"
#include <iostream>

using namespace std;

void* MatrixThread::run(void *param) const{
    RowCol* data = (RowCol*) param;

    unsigned int size = data->size;
    double* row = data->row;
    double* col = data->col;

    double* result = new double();
    *result = 0;
    for (unsigned int i=0; i<size; i++){
        (*result) += row[i]*col[i];
    }

    return result;
}

double MatrixThread::join(){
    double* r = (double*) Thread::join();
    double result = *r;
    delete (double*) r;
    return result;
}
